﻿using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using UnityEngine;
using UnityEngine.UI;

public class TipsView : MonoBehaviour
{
    public Text Tips;

    void Init(string msg)
    {
        Tips.text = msg;
    }

    void OnEnable()
    {
        gameObject.GetComponent<Image>().DOFade(0, 2.5f).OnComplete(() =>
        {
            Destroy(gameObject);
        });
    }

    public static void ShowTips(string msg)
    {
         

        var go = Resources.Load<GameObject>("TipsView");
        go = Instantiate(go);
        go.GetComponent<TipsView>().Init(msg);
        go.transform.SetParent(GameObject.Find("Canvas").transform);
        go.transform.localPosition = Vector3.zero;
        go.transform.localScale = Vector3.one * 4;
        
    }
}
